package camtburist.app02.web.controller;


import camtburist.app02.bean.Test;
import camtburist.app02.service.ITestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private ITestService testService;

    @GetMapping("findAll")
    public List<Test> findAll() {return testService.findAll();}

    @GetMapping("save")
    public String save(Test test){
        testService.save(test);
        return "保存成功";
    }

    @PostMapping("update")
    public String update(Test test){
        testService.update(test);
        return "更新成功";
    }
}
